<div class="r_crumbs">
  <a href="javascript:;">首页</a>
  <a href="javascript:;">网站</a>
  新闻列表
</div>
<div class="r_main">
  <app-alert></app-alert>
  <div class="r_box">
    <div class="r_boxHead">
      <h2>列表</h2>
    </div>
    <div class="r_boxContent">
      <div class="r_boxTool clearfix">

        <div class="r_boxToolFl">
          <div class="row">
            <div class="col-md-4 col-sm-5 ">
              <div class="r_boxToolPad">
                <div class="input-group">
                  <div class="form-control pull-right" style="border: none;background: #f0f7fd;"></div>
                  <!--<span class="input-group-addon" ><i class="fa fa-search"></i></span>-->
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="r_boxToolFRl">
          <button type="button" data-toggle="modal" data-target="#myModal" class="btn btn-primary"
                  (click)="onAddNews()"><i class="fa fa-plus"></i> 新增
          </button>
        </div>
      </div>
      <div>
        <div class="r_boxPad">
          <div class="table-responsive">
            <table class="table table-striped table-bordered table-hover">
              <thead>
              <tr>
                <th>新闻标题</th>
                <th width="200">创建时间</th>
                <th>缩略图</th>
                <th width="120">操作</th>
              </tr>
              </thead>
              <tbody>
              <tr *ngFor="let item of addNews">
                <td>{{item.newsTitle}}</td>
                <td>{{item.newsCreatetime | date:'yyyy-MM-dd'}}</td>
                <td><img src="{{item.newsMainpicurl}}" alt="" id="slt"></td>
                <td style="text-align: center;">
                  <div class="tabledit-toolbar btn-toolbar" style=" display: inline-block;">
                    <div class="btn-group btn-group-sm">
                      <button class="tabledit-edit-button btn btn-sm btn-default" type="button"
                              (click)="onEditNews(item)">编辑
                      </button>
                      <button class="tabledit-delete-button btn btn-sm btn-default" type="button"
                              (click)="onDeleteNews(item)">删除
                      </button>
                      <button class="tabledit-delete-button btn btn-sm btn-default" type="button" id="ifshow"
                              (click)="onTopNews(item)" *ngIf="item.ifIndex">首页
                      </button>
                    </div>
                  </div>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
        <app-pagination [currentPage]="curPage" [totalPages]="addNewsPage?.totalPages"
                        (clickPage)="onPage($event)"></app-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 新增/编辑 -->
<div id="data_editor" class="modal fade" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"
                                                                                          (click)="cancel()">&times;</span>
        </button>
        <h4 class="modal-title">{{editorTitle}}</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="form-group">
          <label for="inputPassword1" class="col-sm-3 control-label">新闻标题</label>
          <div class="col-sm-9">
            <textarea name="DIVCSS5" cols="30" rows="4"  class="form-control" id="inputPassword1" class="logic-textbody" [(ngModel)]="curaddNews.newsTitle">

            </textarea>
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword2" class="col-sm-3 control-label">新闻前段内容</label>
          <div class="col-sm-9">
            <textarea name="DIVCSS5" cols="30" rows="4"  class="form-control" id="inputPassword2" class="logic-textbody" [(ngModel)]="curaddNews.newsContent">

            </textarea>
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword3" class="col-sm-3 control-label">新闻源文件地址</label>
          <div class="col-sm-9">
            <textarea name="DIVCSS5" cols="30" rows="4"  class="form-control" id="inputPassword3" class="logic-textbody" [(ngModel)]="curaddNews.newsUrl">

            </textarea>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">新闻主图:</label>
          <div class="col-sm-9">
            <input type="file" ng2FileSelect [uploader]="uploader" (change)="selectedFileOnChanged($event)"
                 id="inputPassword6" accept="image/png,image/jpeg,image/jpg"/>
            </div>
        </div>
        <div class="form-group" id="ifttt">
          <label class="col-sm-3 control-label">是否置为首页:</label>
          <div class="col-sm-9">
            <input type="checkbox" id="inputPassword7" style="margin: 11px 0 0" [(ngModel)]="curaddNews.iftop">
          </div>
        </div>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" (click)="save()">保存</button>
        <button type="button" class="btn btn-default" data-dismiss="modal" (click)="cancel()">取消</button>
      </div>
    </div>
  </div>
</div>

<!-- 删除 -->
<div id="delete_confirm" class="modal fade  bs-example-modal-lg" role="dialog">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
          aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">是否确定删除该信息?</h4>
      </div>

      <div class="modal-body">
        <div class="table-responsive">
          <table class="table table-bordered">
            <thead>
            <tr>
              <th>新闻简介</th>
              <th>创建时间</th>
              <th>图片地址</th>
              <th>新闻标题</th>
              <th>新闻地址</th>
            </tr>
            </thead>
            <tbody>
            <tr>
              <td>{{curaddNews.newsContent}}</td>
              <td>{{curaddNews.newsCreatetime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
              <td>{{curaddNews.newsMainpicurl}}</td>
              <td>{{curaddNews.newsTitle}}</td>
              <td>{{curaddNews.newsUrl}}</td>
            </tr>
            </tbody>
          </table>

        </div>


      </div>
      <div class="modal-footer" style="text-align: right;">
        <button type="button" class="btn btn-primary" (click)="delete()">确定</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
      </div>
    </div>
  </div>
</div>
